#!/usr/bin/env perl
use strict;
use warnings;
use lib 'tests/search';
use AIR2TestUtils;
use Data::Dump qw( dump );
use Test::More tests => 5;

use_ok('AIR2::SearchUtils');

is( AIR2::SearchUtils::xml_path_for( '1234', Path::Class::dir('foo/bar') ),
    "foo/bar/1/2/1234.xml.gz", "xml_path_for"
);
is( AIR2::SearchUtils::dtim_string_to_ymd('2010-03-29 06:30:45'),
    '20100329', "dtim_string_to_ymd" );

my $authz = {
    '1234' => 1,
    '5678' => 7,
    '9087' => 512,
};

ok( my $authz_packed = AIR2::SearchUtils::pack_authz($authz),
    "pack_authz" );
is_deeply( $authz, AIR2::SearchUtils::unpack_authz($authz_packed),
    "unpack_authz" );

#diag( dump $authz );
#diag( $authz_packed );
